<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button   id="forward"> 前进 </button>
    <button   id="back"> 后退</button>
</body>
<script>
    var back = document.getElementById("back");
    var forward = document.getElementById("forward");
    back.onclick = function(){
        history.back();   //window.history  可以省略 前面的window
    }
    forward .onclick = function(){
        history.forward;
    }
/* 
    页面访问历史
    go（负值） 页面回退
    go（正值    页面前饭
    go （0）  页面 刷新
    */

    go.onclick = function(){
        history.go(0);
    }
    </script>
</html>